package com.wn.airplane_mode.tool;

import java.io.Serializable;


/**
 * @author wuning
 * */
public class AirplaneTaskObj implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private int dayId;
	private String turnOffTime;
	private String turnOnTime;
	private boolean turnOffExecuted;//该时间点当天已经自动执行过
	private boolean turnOnExecuted;//该时间点当天已经自动执行过
	public static final String SPLIT_Field=",";
	
	public AirplaneTaskObj(String str){
		String[]data = str.split(SPLIT_Field);
		dayId = Integer.parseInt(data[0]);
		turnOffTime = data[1];
		turnOnTime = data[2];
		turnOffExecuted = Boolean.parseBoolean(data[3]);
		turnOnExecuted = Boolean.parseBoolean(data[4]);
	}
	
	public String getTurnOffTime() {
		return turnOffTime;
	}
	public void setTurnOffTime(String closeTime) {
		this.turnOffTime = closeTime;
	}
	public String getTurnOnTime() {
		return turnOnTime;
	}
	public void setTurnOnTime(String openTime) {
		this.turnOnTime = openTime;
	}
	
	@Override
	public boolean equals(Object o) {
		if(o instanceof AirplaneTaskObj){
			return ((AirplaneTaskObj)o).getDayId() == this.dayId;
		}
		return false;
	}
	
	@Override
	public String toString() {
		StringBuffer sb = new StringBuffer();
		sb.append(dayId).append(SPLIT_Field).append(turnOffTime).append(SPLIT_Field).append(turnOnTime).
		append(SPLIT_Field).append(turnOffExecuted).append(SPLIT_Field).append(turnOnExecuted);
		return sb.toString();
	}
	
	
	public int getDayId() {
		return dayId;
	}
	public void setDayId(int dayId) {
		this.dayId = dayId;
	}

	public boolean isTurnOffExecuted() {
		return turnOffExecuted;
	}

	public void setTurnOffExecuted(boolean turnOffExecuted) {
		this.turnOffExecuted = turnOffExecuted;
	}

	public boolean isTurnOnExecuted() {
		return turnOnExecuted;
	}

	public void setTurnOnExecuted(boolean turnOnExecuted) {
		this.turnOnExecuted = turnOnExecuted;
	}
}